#include "widget.h"
#include "ui_widget.h"
#include <QButtonGroup>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
//    ui->label->setText("您的性别为：男");
//    ui->radioButton_male->setChecked(true);
//    ui->radioButton_other->setEnabled(false);
    QButtonGroup* bg1 = new QButtonGroup(this);
    QButtonGroup* bg2 = new QButtonGroup(this);
    QButtonGroup* bg3 = new QButtonGroup(this);

    bg1->addButton(ui->radioButton_male);
    bg1->addButton(ui->radioButton_female);
    bg1->addButton(ui->radioButton_other);

    bg2->addButton(ui->radioButton_phone);
    bg2->addButton(ui->radioButton_computer);
    bg2->addButton(ui->radioButton_keyboard);

    bg3->addButton(ui->radioButton_clothes);
    bg3->addButton(ui->radioButton_trousers);
    bg3->addButton(ui->radioButton_hat);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_radioButton_male_clicked()
{
    ui->label->setText("您的性别为：男");
}

void Widget::on_radioButton_female_clicked()
{
    ui->label->setText("您的性别为：女");
}

void Widget::on_radioButton_other_clicked()
{
    ui->label->setText("您的性别为：其他");
}
